import struct

def reverseHex(hexStr):
    list = []
    for i in range(len(hexStr)-1, -1, -2):
        list.append(hexStr[i-1]+hexStr[i])

    return ''.join(list)

def hex2int(hexStr):
    hexStr = reverseHex(hexStr)
    return struct.unpack('!i', hexStr.decode('hex'))[0]

def hex2float(hexStr):
    hexStr = reverseHex(hexStr)
    return struct.unpack('f', hexStr.decode('hex'))[0]

def hex2double(hexStr):
    hexStr = reverseHex(hexStr)
    return struct.unpack('d', hexStr.decode('hex'))[0]

def hex2long(hexStr):
    hexStr = reverseHex(hexStr)
    return struct.unpack('l', hexStr.decode('hex'))[0]

def hex2uint(hexStr):
    hexStr = reverseHex(hexStr)
    return struct.unpack('I', hexStr.decode('hex'))[0]

print reverseHex('43a7799a')
